#include <bits/stdc++.h>
// 2025/07/23
// tag: 
// Author: Forever
using namespace std;
using int64 = int64_t;

int n, m, t, cnt, in[100001], ans[100001];
vector<int> edge[100001];

void topo() {
    priority_queue<int> q;
    cnt = 0;
    for (int i = 1; i <= n; i++) 
        if (in[i] == 0) 
            q.push(i);
    while (!q.empty()) {
        int x = q.top();
        q.pop();
        ans[++cnt] = x;
        for (int y : edge[x]) {
            if (--in[y] == 0) 
                q.push(y);
        }
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> t;
    while (t--) {
        cin >> n >> m;
        for (int i = 1; i <= n; i++) {
            edge[i].clear();
            in[i] = 0;
        }
        for (int i = 1; i <= m; i++) {
            int x, y;
            cin >> x >> y;
            edge[y].push_back(x);
            in[x]++;
        }
        topo();
        if (cnt != n)
            cout << "Impossible!";
        else
            for (int i = 0; i < n; i++)
                cout << ans[n - i] << " ";
        cout << endl;
    }
    return 0;
}